package com.example.forum.exception;

import com.example.forum.common.AppResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;

/**
 * 自定义异常
 */
public class ApplicationException extends RuntimeException{
    protected AppResult errorResult;

    public ApplicationException(AppResult errorResult) {
        super(errorResult.getMeassge());
        this.errorResult = errorResult;
    }

    /**
     * 构造方法
     * @param message
     */
    public ApplicationException(String message) {
        super(message);
    }

    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApplicationException(Throwable cause) {
        super(cause);
    }

    public AppResult getErrorResult() {
        return errorResult;
    }
}
